﻿using GN.Pay.Core.Exceptions;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace GN.Pay.Core.Values.TradeRefund
{
    /// <summary>
    /// 交易退款申请信息
    /// </summary>
    public class TradeRefundApplyInfo : TradeRefundApplyBase<TradeRefundApplyInfo>
    {
        /// <summary>
        /// 通知地址(Post)
        /// </summary>
        [StringLength(maximumLength: 255)]
        public string NotifyUrl { get; set; }

        /// <summary>
        /// 扩展参数
        /// </summary>        
        public string ExtraParam { get; set; }

        /// <summary>
        /// 
        /// </summary>
        public void Validate()
        {
            if (ApplyMoney <= 0)
            {
                PayExceptionUtils.ThrowPayValidationException("申请金客必须大于零。");
            }
            ApplyMoney = Math.Round(ApplyMoney, 2);
        }
    }
}
